package com.ljf.app1;

import com.ljf.framework.exception.LjfException;
import com.ljf.framework.result.JsonResult;
import com.ljf.framework.result.JsonResultEnum;
import com.ljf.framework.security.LjfSecurityManager;
import com.ljf.sso.SsoManager;
import org.springframework.web.bind.annotation.*;

/**
 * 说明：
 *
 * @Auther: lijinfeng
 * @Date: 2024/4/17
 */
@RestController
public class App1Controller {

    @PostMapping("/auth/login")
    public JsonResult login(@RequestBody LoginBodyVO loginUser) {
        return LjfSecurityManager.doLogin(loginUser.getUsername(), loginUser.getPassword());
    }


    @PutMapping("/logout")
    public JsonResult loginOut() {
        throw new LjfException(JsonResultEnum.ERROR,"");
    }


    @GetMapping("/user")
    public JsonResult getUser() {
        return JsonResult.success("获取APP1用户成功"+ SsoManager.getServerConfig().open);
    }
}
